package cn.wolfcode.service.impl;

import cn.wolfcode.mapper.ConsumptionReportMapper;
import cn.wolfcode.qo.ConsumptionReportQueryObject;
import cn.wolfcode.service.IConsumptionReportService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class ConsumptionReportServiceImpl implements IConsumptionReportService {

    @Autowired
    private ConsumptionReportMapper consumptionReportMapper;

    @Override
    public PageInfo<Map<String,Object>> query(ConsumptionReportQueryObject qo) {
        // 使用分页插件，传入当前页，每页显示数量
        PageHelper.startPage(qo.getCurrentPage(), qo.getPageSize());
        // 返回查询一页展示的数据
        return new PageInfo<Map<String,Object>>(consumptionReportMapper.selectForList(qo));
    }

    /*@Override
    public List<Map<String, Object>> queryByChart(String groupType) {
        return consumptionReportMapper.selectForChart(groupType);
    }*/
}
